package com.nbsaas.boot.script.rest.resource;

import com.nbsaas.boot.script.api.apis.ScriptTemplateApi;
import com.nbsaas.boot.script.data.entity.ScriptTemplate;
import com.nbsaas.boot.script.api.domain.request.ScriptTemplateRequest;
import com.nbsaas.boot.script.api.domain.response.ScriptTemplateResponse;
import com.nbsaas.boot.script.api.domain.simple.ScriptTemplateSimple;
import com.nbsaas.boot.script.rest.convert.ScriptTemplateSimpleConvert;
import com.nbsaas.boot.script.rest.convert.ScriptTemplateEntityConvert;
import com.nbsaas.boot.script.rest.convert.ScriptTemplateResponseConvert;
import com.nbsaas.boot.script.data.repository.ScriptTemplateRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import jakarta.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   -业务接口实现
*/
@Transactional
@Service
public class ScriptTemplateResource extends BaseResource<ScriptTemplate,ScriptTemplateResponse, ScriptTemplateSimple, ScriptTemplateRequest>  implements ScriptTemplateApi {

    @Resource
    private ScriptTemplateRepository scriptTemplateRepository;

    @Override
    public JpaRepositoryImplementation<ScriptTemplate, Serializable> getJpaRepository() {
        return scriptTemplateRepository;
    }

    @Override
    public Function<ScriptTemplate, ScriptTemplateSimple> getConvertSimple() {
        return new ScriptTemplateSimpleConvert();
    }

    @Override
    public Function<ScriptTemplateRequest, ScriptTemplate> getConvertForm() {
        return new ScriptTemplateEntityConvert();
    }

    @Override
    public Function<ScriptTemplate, ScriptTemplateResponse> getConvertResponse() {
        return new ScriptTemplateResponseConvert();
    }




}


